---
title: "Count"
"og:title": "dub.links.count - Retrieve the number of links - TypeScript SDK"
description: "Retrieve the number of links for the authenticated workspace. The provided query parameters allow filtering the returned links."
---

## Arguments

<ParamField body="domain" type="string">
  The domain to filter the links by. E.g. `ac.me`. If not provided, all links
  for the workspace will be returned.
</ParamField>

<ParamField body="tagId" type="string">
  The tag ID to filter the links by. This field is deprecated – use `tagIds`
  instead.
</ParamField>

<ParamField body="tagIds" type="string">
  The tag IDs to filter the links by.
</ParamField>

<ParamField body="search" type="string">
  The search term to filter the links by. The search term will be matched
  against the short link slug and the destination URL.
</ParamField>

<ParamField body="userId" type="string">
  The user ID to filter the links by.
</ParamField>

<ParamField body="showArchived" type="boolean" default={false}>
  Whether to include archived links in the response. Defaults to `false` if not
  provided.
</ParamField>

<ParamField body="withTags" type="boolean" default={false}>
  Whether to include tags in the response. Defaults to `false` if not provided.
</ParamField>

<ParamField body="groupBy" type="string">
  The field to group the links by. Available options are `domain` and `tagId`.
</ParamField>

## Response

The number of links matching the query.

<RequestExample>

```ts
// Count links by domain
await dub.links.count({
  domain: "dub.sh",
});

// Count links by tagIds
await dub.links.count({
  tagIds: ["clv3mewk30001mq0rxl3j3frn"],
});
```

</RequestExample>

<ResponseExample>

```ts
2;
```

</ResponseExample>
